import request from "@/utils/request"

// 请求参数类型
type SubjectParamsType = {
    level:number |string;
    pageIndex:number;
    pageSize:number
}
//请求编辑参数类型
// type SUbjetcEditType={
//     id:number;
//     name:string;
//     level:number |string;
//     levelName:string
// }
type SubjectResponseType<T> = {
    total:number;
    list:T[]
}

//返回值类型
export type SubjectType ={
    id:number;
    name:string;
    level:number;
    levelName:string
}
export function subjectPage(data: SubjectParamsType) {
    return request.post<SubjectResponseType<SubjectType>>("/api/admin/education/subject/page", data)
}
//添加参数类型
export type SubjectAddParamsType ={
    id:null;
    level:number|string;
    levelName:string;
    name:string
}
export type SubjectEditParamsType ={
    id:number|string;
    level:number|string;
    levelName:string;
    name:string
}
//学科添加/编辑接口
export function subjectAdd(data: SubjectAddParamsType) {
    return request.post<null>("/api/admin/education/subject/edit", data)
}
export function subjectEdit(data: SubjectEditParamsType) {
    return request.post<null>("/api/admin/education/subject/edit", data)
}
